package com.io.page;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created by as on 2016/11/17.
 */
public class FileInOutEx {
    public static void main(String[] args) throws IOException {
        File file_Book1 = new File("Book1.txt");
        String bookInfo = "世界和平\t 350.0\t Friedman\t";
        file_Book1.createNewFile();

        FileOutputStream fos = new FileOutputStream(file_Book1);
        fos.write(bookInfo.getBytes());
        fos.close();

        FileInputStream fis = new FileInputStream(file_Book1);
        System.out.println("书籍名称\t 价格\t 作者\t");
        System.out.println("- - - - - - - - - - - - - - - - -");

        int i = 0;
        while ( (i=fis.read()) != -1)
        {
            System.out.print((char)i);
        }
        fis.close();
    }
}
